import axios from '@/libs/api.request'
import Url from '@/tool/Url'

export const getQiniu = () => {
  return axios.request({
      url: 'qiniu/get-token',
      method: 'post'
  })
}

//账号密码登录
export const loginByUsername = data => {
    return axios.request({
        url: '/backend/user/login',
        method: 'post',
        data
    })
}

//三级省市区列表
export const getProvinceList = data => {
    return axios.request({
        url: '/backend/area/get-province-list',
        method: 'post',
        data
    })
}

//三级省市区列表
export const getAddress = data => {
    return axios.request({
        url: '/backend/area/three-city-list',
        method: 'post',
        data
    })
}

//获取平台配置信息
export const getSettingInfo = data => {
  return axios.request({
      url: '/backend/setting/get-setting-info',
      method: 'post',
      data
  })
}

//设置平台配置信息
export const saveSettingInfo = data => {
  return axios.request({
      url: '/backend/setting/save-setting-info',
      method: 'post',
      data
  })
}

//轮播图列表
export const bannerList = data => {
    return axios.request({
        url: '/backend/banner/banner-list',
        method: 'post',
        data
    })
}

//编辑轮播图
export const editBanner = data => {
    return axios.request({
        url: '/backend/banner/edit-banner',
        method: 'post',
        data
    })
}

//修改轮播图状态
export const changeBannerStatus = data => {
    return axios.request({
        url: '/backend/banner/change-banner-status',
        method: 'post',
        data
    })
}

//商品分类列表
export const goodCateList = data => {
    return axios.request({
        url: '/backend/good/good-cate-list',
        method: 'post',
        data
    })
}

//编辑商品分类
export const editGoodCate = data => {
    return axios.request({
        url: '/backend/good/edit-good-cate',
        method: 'post',
        data
    })
}

//修改商品分类状态
export const changeGoodCateStatus = data => {
    return axios.request({
        url: '/backend/good/change-good-cate-status',
        method: 'post',
        data
    })
}

//商品分类筛选项
export const goodCateForSelect = data => {
    return axios.request({
        url: '/backend/good/good-cate-for-select',
        method: 'post',
        data
    })
}

//商品列表
export const goodList = data => {
    return axios.request({
        url: '/backend/good/good-list',
        method: 'post',
        data
    })
}

//编辑商品
export const editGood = data => {
    return axios.request({
        url: '/backend/good/edit-good',
        method: 'post',
        data
    })
}

//修改商品状态
export const changeGoodStatus = data => {
    return axios.request({
        url: '/backend/good/change-good-status',
        method: 'post',
        data
    })
}

//商品详情
export const getGoodDetail = data => {
    return axios.request({
        url: '/backend/good/good-detail',
        method: 'post',
        data
    })
}

//商品筛选项数据源
export const goodListForSelect = data => {
    return axios.request({
        url: '/backend/good/good-list-for-select',
        method: 'post',
        data
    })
}

//会员列表
export const getMemberList = data => {
    return axios.request({
        url: '/backend/member/member-list',
        method: 'post',
        data
    })
}

//资产信息
export const financeInfo = data => {
    return axios.request({
        url: '/backend/finance/finance-info',
        method: 'post',
        data
    })
}

//账单明细
export const orderRecord = data => {
    return axios.request({
        url: '/backend/finance/order-record',
        method: 'post',
        data
    })
}

//编辑流水说明
export const editRemark = data => {
    return axios.request({
        url: '/backend/finance/edit-remark',
        method: 'post',
        data
    })
}

//订单列表
export const orderList = data => {
    return axios.request({
        url: '/backend/order/order-list',
        method: 'post',
        data
    })
}

//订单商品列表
export const orderGoodList = data => {
    return axios.request({
        url: '/backend/order/order-good-list',
        method: 'post',
        data
    })
}

//订单详情
export const orderInfo = data => {
    return axios.request({
        url: '/backend/order/order-info',
        method: 'post',
        data
    })
}

//订单发货
export const orderSend = data => {
    return axios.request({
        url: '/backend/order/order-send',
        method: 'post',
        data
    })
}

//修改发货信息
export const modifyOrderSend = data => {
    return axios.request({
        url: '/backend/order/modify-order-send',
        method: 'post',
        data
    })
}

//修改订单卖家备注
export const editRemarkShop = data => {
    return axios.request({
        url: '/backend/order/edit-remark-shop',
        method: 'post',
        data
    })
}

//退款列表
export const orderRefundList = data => {
    return axios.request({
        url: '/backend/order/order-refund-list',
        method: 'post',
        data
    })
}

//审核退款
export const auditOrderRefund = data => {
    return axios.request({
        url: '/backend/order/audit-order-refund',
        method: 'post',
        data
    })
}

//管理员列表
export const getUserList = data => {
    return axios.request({
        url: '/backend/user/manager-list',
        method: 'post',
        data
    })
}

//管理员状态
export const changeUserStatus = data => {
    return axios.request({
        url: '/backend/user/change-user-status',
        method: 'post',
        data
    })
}

//添加编辑管理员
export const createUser = data => {
    return axios.request({
        url: '/backend/user/edit',
        method: 'post',
        data
    })
}

// 角色列表
export const roleList = data => {
    return axios.request({
        url: '/backend/role/role-list',
        method: 'post',
        data
    })
}

// 创建角色
export const createRole = data => {
    return axios.request({
        url: '/backend/role/create-role',
        method: 'post',
        data
    })
}

// 更新角色
export const updateRole = data => {
    return axios.request({
        url: '/backend/role/update-role',
        method: 'post',
        data
    })
}

// 删除角色
export const deleteRole = data => {
    return axios.request({
        url: '/backend/role/delete-role',
        method: 'post',
        data
    })
}

// 角色详情
export const getRoleInfo = data => {
    return axios.request({
        url: '/backend/role/role-info',
        method: 'post',
        data
    })
}

// 创建角色选择权限列表
export const getAuthList = data => {
    return axios.request({
        url: '/backend/permission/tree-data',
        method: 'post',
        data
    })
}

// 权限列表
export const authList = data => {
    let url = Url.getPath('/backend/permission/auth-list', data)
    return axios.request({
        url: url,
        method: 'get',
    })
}

// 创建权限
export const createAuth = data => {
    return axios.request({
        url: '/backend/permission/create-auth',
        method: 'post',
        data
    })
}

// 删除权限
export const deleteAuth = data => {
    return axios.request({
        url: '/backend/permission/delete-auth',
        method: 'post',
        data
    })
}

// 根据角色获取权限
export const getRoleAuth = data => {
    return axios.request({
        url: '/backend/permission/get-role-auth',
        method: 'post',
        data
    })
}
